﻿@namespace ThingsGateway.Gateway.Razor



@using ThingsGateway.Admin.Application
@attribute [Authorize]
@attribute [IgnoreRolePermission]


@{
#if !Admin

    <IndexComponent Localizer=Localizer></IndexComponent>

    <div class="row g-2 mx-1 form-inline">

        <div class="col-12  col-md-6 sh">

            <Card IsShadow=true class="m-2 flex-fill" Color="Color.Primary">
                <HeaderTemplate>
                    @Localizer["Shortcuts"]
                </HeaderTemplate>

                <BodyTemplate>
                    @foreach (var menu in AppContext.UserWorkbenchOutputs ?? new List<SysResource>())
                    {
                        <LinkButton Url="@menu.Href" Target="@menu.Target.ToString()" Color="Color.Primary">
                            <i class="@menu.Icon"></i>
                            <span>@menu.Title</span>
                        </LinkButton>
                    }
                </BodyTemplate>
            </Card>
        </div>

        <div class="col-12  col-md-6 sh">

            <Card IsShadow=true class="m-2 flex-fill">
                <HeaderTemplate>
                    @Localizer["OperLog"]
                </HeaderTemplate>

                <BodyTemplate>
                    <Timeline Items="SysOperateLogItems"></Timeline>
                </BodyTemplate>
            </Card>

        </div>
    </div>
    
    <div class="row g-2 mx-1 form-inline">

        <div class="col-12  col-md-6 sh">

            <Card IsShadow=true class="m-2 flex-fill">
                <HeaderTemplate>
                    @Localizer["BackendLog"]
                </HeaderTemplate>

                <BodyTemplate>
                    <Timeline Items="BackendLogItems"></Timeline>
                </BodyTemplate>
            </Card>
        </div>

        <div class="col-12  col-md-6 sh" >

            <Card IsShadow=true class="m-2 flex-fill">
                <HeaderTemplate>
                    @Localizer["RpcLog"]
                </HeaderTemplate>

                <BodyTemplate>
                    <Timeline Items="RpcLogItems"></Timeline>
                </BodyTemplate>
            </Card>

        </div>
    </div>

    <Card IsShadow=true class="m-2 flex-fill" Color="Color.Primary">
        <HeaderTemplate>
            @Localizer["HardwareInfoChart"]
        </HeaderTemplate>

        <BodyTemplate>
            <Chart @ref=CPULineChart OnInitAsync="OnCPUInit" Height="var(--line-chart-height)" Width="100%" OnAfterInitAsync="()=>{chartInit=true;return Task.CompletedTask;}" />
        </BodyTemplate>
    </Card>

#endif
}
